#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
Converting DMConcinnity-HD.EvoGP to DMConcinnity-HD.EvoTGP
'''

import os, sys

print("Python version: " + sys.version)
print(__doc__)

SKIN_XML = 'skin.xml'
MAIN_SKIN = 'DMConcinnity-HD.EvoGP'
EvoTGP = {
            'path':'DMConcinnity-HD.EvoTGP',
            'changes':
            (
            ('DMConcinnity-HD.EvoGP', 'DMConcinnity-HD.EvoTGP'),
            ('color name="background" value="#00000000"', 'color name="background" value="#40000000"'),
            ('color name="backbottom" value="#00ffffff"', 'color name="backbottom" value="#40ffffff"'),
            ('color name="backbottomIB" value="#00000000"', 'color name="backbottomIB" value="#40000000"'),
            ('color name="backbottomMENU" value="#00ffffff"', 'color name="backbottomMENU" value="#40ffffff"'),
            ('color name="background2" value="#0038435a"', 'color name="background2" value="#4038435a"'),
            ('color name="backIB" value="#00ffffff"', 'color name="backIB" value="#40ffffff"'),
            ('color name="backtop" value="#00ffffff"', 'color name="backtop" value="#40ffffff"'),
            ('color name="backtopIB" value="#00000000"', 'color name="backtopIB" value="#40000000"'),
            ('color name="chansel" value="#00aaaaaa"', 'color name="chansel" value="#00000000"'),
			('ePixmap alphatest="blend" pixmap="DMConcinnity-HD.EvoTGP/images/GP3.png" position="745,486" size="339,88"','ePixmap alphatest="on" pixmap="DMConcinnity-HD.EvoTGP/images/GP3.png" position="745,486" size="339,88"'),
            )
        }

SKINS = (EvoTGP,)

for changes in SKINS:
    skin_dir = changes['path']
    print(skin_dir)
    skin_main = open(os.path.join(MAIN_SKIN, SKIN_XML), 'rb')
    skin_new = open(os.path.join(skin_dir, SKIN_XML), 'wb')
    for nline in skin_main:
        for ch in changes['changes']:
            nline = nline.replace(ch[0].encode('utf-8'), ch[1].encode('utf-8'))
        skin_new.write(nline)

    skin_main.close()
    skin_new.close()
